import { cloudService } from './index'
import { IFileInfo } from '@/types/file'

export const uploadFileApi = (form: FormData, path: string, md5: string): Promise<any> =>
  cloudService({
    url: '/home-api/file',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    method: 'post',
    params: { path, md5 },
    data: form
  })

export const getFolderInfoApi = (folderName: string): Promise<IFileInfo[]> =>
  cloudService({
    url: '/home-api/file/catalog',
    method: 'get',
    params: { folderName }
  })
